const Sequelize = require('sequelize');
const DB = require("../config/dbconfig");

const tagModel = DB.define('tag_tab', {
    tag_id: {
      type: Sequelize.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "标签id,主键"
    },
    tag_name: {
      type: Sequelize.STRING(50),
      allowNull: true,
      comment: "标签名"
    },
    create_time:{
      type:Sequelize.DATE,
      allowNull:true,
      comment:"创建时间"
    },
    is_delete:{
      type:Sequelize.INTEGER(2),
      comment:"是否删除"
    },
    creater_type:{
      type:Sequelize.INTEGER(1),
      comment:"创建标签的用户类型，1是管理员，0是小程序用户"
    },
    nickname:{
      type:Sequelize.STRING(20),
      comment:"创建标签的用户名，与user_tab的nickname一样"
    }
  }, {
    Sequelize,
    tableName: 'tag_tab',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "tag_id" },
        ]
      },
    ]
  });
module.exports = tagModel
